<?php
/**
 * Created by PhpStorm.
 * User: zkc
 * Date: 2019-04-28
 * Time: 14:52
 */

$file = $_GET['file'];

$ext = pathinfo($file, PATHINFO_EXTENSION);


if(!in_array($ext, ['js', 'php', 'html'])) {
    $ext = 'text';
}

?>

<link rel="stylesheet" type="text/css" href="https://cdn.bootcss.com/SyntaxHighlighter/3.0.83/styles/shCore.css">
<link rel="stylesheet" type="text/css" href="https://cdn.bootcss.com/SyntaxHighlighter/3.0.83/styles/shThemeDefault.css">
<script type="text/javascript" src="https://cdn.bootcss.com/SyntaxHighlighter/3.0.83/scripts/shCore.js"></script>
<script type="text/javascript" src="https://cdn.bootcss.com/SyntaxHighlighter/3.0.83/scripts/shBrushXml.js"></script>
<!-- 支持的格式 http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/ -->
<script type="text/javascript" src="https://cdn.bootcss.com/SyntaxHighlighter/3.0.83/scripts/shBrushPhp.js"></script>
<script type="text/javascript" src="https://cdn.bootcss.com/SyntaxHighlighter/3.0.83/scripts/shBrushJScript.js"></script>
<script type="text/javascript" src="https://cdn.bootcss.com/SyntaxHighlighter/3.0.83/scripts/shBrushPlain.js"></script>
<script type="text/javascript">SyntaxHighlighter.all();</script>
<pre class="brush: <?=$ext ?>">
<?=file_get_contents($file); ?>
</pre>
